<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
	
	<div class="navbar navbar-static" id="navbar-example">
	     <div class="navbar-inner" >
			<div class="container">
				  <div style="width: auto;" class="container">
					<a href="#" class="brand"><h3 style="color:#fff">PMS-项目管理系统</h3></a>
					
					<ul class="nav pull-right">
						<li id="fat-menu" class="dropdown">
							<a class="dropdown-toggle" data-toggle="dropdown" href="#" style="">
							<div class="geng"></b><i class="icon-user icon-white"></i>&nbsp${session_em.username}&nbsp<b class="caret"></b></div>
							</a>
							<ul class="dropdown-menu">
							<li>
								<a class="" href="#myModal" data-toggle="modal"><span class="icon-edit"></span>修改密码</a>
							</li>
							<li>
								<a href="#myModal1" data-toggle="modal"><span class="icon-repeat"></span>上传头像</a>
							</li>
							<li class="divider"></li>
							<li>
								<a href="invalidate.jspx"><span class="icon-off"></span>安全退出</a>
							</li>
							</ul>
						</li>
					</ul>
				 </div>
			</div>
		</div>
	</div>

   
 	<div id="myModal" class="modal hide fade in fade" style="display:none;" style="width:100px">
		<div class="modal-header">
			<a class="close" data-dismiss="modal">×</a>
			<h3>修改密码</h3>
		</div>
		<div class="modal-body " style="padding-left:150px;">
			<span id="ok"></span>
			<form action="javascript:;" method="post">
				<h4>请输入原密码：</h4><input type="password" name="oldPwd" id="oldPwd" />
				<span id="error1"></span>
				<br/>
				<h4>请输入新密码：</h4><input type="password" name="newPwd" id="newPwd" /><br/>
				<h4>再次输入新密码：</h4><input type="password" name="scPwd" id="scPwd" />
				<span id="error2"></span><br/>
				
				<button type="submit" class="btn btn-primary" id="updatePwd">确定</button>
				<a class="btn" data-dismiss="modal" href="#">取消</a>
			</form>
		</div>
		<div class="modal-footer">
		
		</div>
	</div>
	<div id="myModal1" class="modal hide fade in fade" style="display:none;" style="width:100px">
		<div class="modal-header">
			<a class="close" data-dismiss="modal">×</a>
			<h3>上传头像</h3>
		</div>
		<div class="modal-body " style="padding-left:150px;">
			<form action="uploadimg.jspx" method="post" enctype="multipart/form-data">
		    	<span>选择文件：</span><input type="file" name="file"/><br/></br>
		    	<button type="submit" id="uploadbtn" class="btn btn-primary">上传</button>
		    	<a href="" class="btn">返回</a>
		    </form>

		</div>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#updatePwd").click(function(){
				var oldPwd = $("#oldPwd").val();
				var newPwd = $("#newPwd").val();
				var scPwd = $("#scPwd").val();
				$.ajax({
					   type: "POST",
					   url: "updatePwd.jspx",
					   data: "oldPwd=" + oldPwd + "&newPwd=" + newPwd + "&scPwd=" + scPwd,
					   success: function(result){
						   if("ok" == result){
							   $("#ok") == "";
							   $("<span>").attr("style","display:none").appendTo($("#ok"));
							   $("<span>").attr("style","color:blue").text("修改密码成功！").appendTo($("#ok"));
						   }
						   if("error1" == result){
							   $("#error1") == "";
							   $("<span>").attr("style","color:red").text("你输入的密码错误！").appendTo($("#error1"));
						   }
						   if("error2" == result){
							   $("#error2") == "";
							   $("<span>").attr("style","color:red").text("二次输入的密码错误！").appendTo($("#error2"));
						   }
					   }
					}); 
				
			});
		});
		
	</script>
